//
//  Hairline.m
//  taobisu
//
//  Created by wwj on 15/6/3.
//  Copyright (c) 2015年 com.chnbst. All rights reserved.
//

#import "Hairline.h"

@implementation Hairline


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    
    CGRect frame = self.bounds;
        
    if(frame.size.height<5){
        if (self.vLineAlignBottom) {
            frame.origin.y = frame.size.height - 1.0 / [UIScreen mainScreen].scale;
        }
        frame.size.height = 1.0 / [UIScreen mainScreen].scale;
    }
    else if(frame.size.width < 5){
        if (self.hLineAlignRight) {
            frame.origin.x = frame.size.width - 1.0 / [UIScreen mainScreen].scale;
        }
        frame.size.width = 1.0 / [UIScreen mainScreen].scale;
    }
    
    UIView *view = [[UIView alloc]initWithFrame:frame];
    UIColor *lineColor = MyColor(216, 216, 216);
    view.backgroundColor = lineColor;
    [self addSubview:view];
}


-(void)awakeFromNib{
    [super awakeFromNib];
    self.backgroundColor = [UIColor clearColor];
    
    /*
    self.layer.borderColor = [UIColor colorWithRed:200.0/255.0f green:199.0/255.0f blue:204.0/255.0f alpha:0.9].CGColor;
    self.layer.borderWidth = (1.0 / [UIScreen mainScreen].scale) / 2;
    self.backgroundColor = [UIColor clearColor];*/
}

@end
